import 'package:imperius_insights/entity/project.dart';

import 'service.dart';

class Domain {
  Service _service;

  Domain() {
    _service = Service();
  }

  Future<List<Project>> load({ String departmentId, String scopeHumanId }) async {
    return await _service.load(departmentId: departmentId, scopeHumanId: scopeHumanId);
  }

  Future<List<Project>> loadMulti({ List<String> departmentIds, String scopeHumanId }) async {
    final futures = departmentIds.map((departmentId) => _service.load(departmentId: departmentId, scopeHumanId: scopeHumanId));
    final projects = List<Project>();
    (await Future.wait(futures)).forEach((element) => projects.addAll(element));
    return projects;
  }
}
